﻿using System.Linq;
using VsxFactory.Modeling.VisualStudio;
using System;

namespace VsxFactory.Modeling.Strategies.VisualStudio
{
    class VSSolutionItems : VSContainer, IVsSolutionItems
    {
        internal VSSolutionItems(IVsSolution solution)
            : base(solution)
        {
            System.Diagnostics.Contracts.Contract.Requires(solution != null);

            var node = ((SolutionNode)solution.ExternalObject).AllElements
                .Where(p => p.IsSolutionItemsFolder)
                .FirstOrDefault();
            if (node != null)
                this.node = node;
        }

        internal VSSolutionItems(IVsSolution solution, HierarchyNode node)
            : base(solution, node)
        {
            System.Diagnostics.Contracts.Contract.Requires(solution != null);
            System.Diagnostics.Contracts.Contract.Requires(node != null);
        }

        public virtual string Path
        {
            get { return Solution.Path; }
        }
    }

}
